﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BAL;
using System.Data;
using System.Data.SqlClient;

namespace UI
{
    public partial class LoaiSanPham : System.Web.UI.Page
    {
        SanPhamBus sp = new SanPhamBus();
        private string loadSP()
        {
            DataTable dt = new DataTable();
            string mansx = Request.QueryString["MaNSX"].ToString();
            dt = sp.getAllSanPham3(mansx);
            string str = "";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                str += "<div class=\"prod_box\"> " +
                       "<div class=\"top_prod_box\"></div> "
                       + " <div class=\"center_prod_box\"> "
                       + "<div class=\"product_title\"><a href=\"details.aspx\">" + dt.Rows[i]["TenSP"] + "</a></div> "
                   + "<div class=\"product_img\"><a href=\"details.aspx?MaSP=" + dt.Rows[i]["MaSP"] + "\"><img  alt=\"\" border=\"0\" style=\"height: 87px; width: 154px\" src=\"images/" + dt.Rows[i]["Image1"] + "\" alt=\"\" border=\"0\" /></a></div> "
                   + "<div class=\"prod_price\"> <span class=\"price\">" + dt.Rows[i]["DonGia"] + "</span></div> "
                           + "</div> "
                   + "<div class=\"bottom_prod_box\"></div>"
                   + "<div class=\"prod_details_tab\"><a href=\"themsanphamvaogio.aspx?MaSP=" + dt.Rows[i]["MaSP"] + "\"><img src=\"images/datmua_icon.jpg\" style=\"width: 171px; height: 25px\" /></a> </div> "
                   + "</div> ";
            }

            return str;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = loadSP();      
        }
    }
}